<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<%@page 
	contentType ="text/html; charset=windows-874" 
	import="java.util.Vector,
					com.softplus.carrefour.hd.bltier.admin.IMdStoreViewer,
					com.softplus.carrefour.hd.bltier.admin.MdStoreManage,
					com.softplus.carrefour.hd.CFHDSystem,
					com.epro.standard.frontend.util.EproServletUtil,
					com.epro.standard.frontend.lov.EproLOV,
					com.epro.standard.frontend.lov.EproLOVColumn,
					com.softplus.carrefour.hd.bltier.entity.UserAccount,
					java.util.HashMap"
%>
<HTML>
<HEAD>
</HEAD>
	<%@taglib uri="/WEB-INF/HeadTag.tld"  prefix="header"%>
	<%@taglib uri="/WEB-INF/LovTag.tld"   prefix="lov"%>
<header:Head 
	author		=	"Udong"
	title				="LOV of site(Store)"
	import		=""	   	
	jsFile			="../script/imgProp.js"
	styleFile	="../theme/LovTheme.css"></header:Head>
<%
	java.util.Date startDate = new java.util.Date() ;
	String size = request.getParameter("size") == null ? "m" : request.getParameter("size") ;

	UserAccount		userVO			=	(UserAccount) session.getAttribute("userVO"); //"kunlaporn_c";
	String					countryID		=	userVO.getCountry().getCountryId();
	System.out.println("...........country id.................."+countryID);

//  Create Manager
	IMdStoreViewer	storeManage	=	(MdStoreManage)CFHDSystem.getControlClass("MD_STORE");

// Create datavector & Keywords.
	
	EproServletUtil servletUtil = new EproServletUtil(request) ;
	
	startDate = new java.util.Date() ;
	com.epro.standard.frontend.lov.LOVKeyword keyword = new com.epro.standard.frontend.lov.LOVKeyword() ;
//	Get search keyword.
	String searchKeyword = servletUtil.getRequestValue("searchKeyword") ;
//	Set condition.
	HashMap	condition	= new HashMap();
	if(!countryID.equals(""))
	{	condition.put("countryID",countryID);	}

	String cNames[] = servletUtil.getRequestValues("searchColumnName") ;
	Vector checkBoxVec = new Vector();
	keyword.setMessage(searchKeyword);
	keyword.setCondition(condition);
	if(cNames != null)
		for(int i = 0 ; i < cNames.length ; i++)
			checkBoxVec.add(com.epro.standard.frontend.util.StringUtil.stringTokenToArray(cNames[i])[0]) ;
	keyword.setCheckBox(checkBoxVec);

	// 1. Create LOV Object.
	EproLOV lov = new EproLOV() ;

	// 2. Adding columns.
	//								EproLOVColumn(String label, String justify, Integer width, boolean isDisplay) ;
	//lov.addColumn(EproLOVColumn("", "", 0, false)) ;
	lov.addColumn(new EproLOVColumn("Store ID", "left", 10, true)) ;
	lov.addColumn(new EproLOVColumn("Store Name", "left", 50, true)) ;
//	lov = dataManager.getAllProject(lov , keyword) ;

	startDate = new java.util.Date() ;

   lov.addRow(storeManage.getLOVmdStore(keyword));

	int	vectorSize = 0 ;

	vectorSize = lov.getBodyRows().size();
	System.out.println("getLOV with : " + (new java.util.Date().getTime() - startDate.getTime())/1000) ;
	startDate = new java.util.Date() ;

	boolean isMultiple = request.getParameter("isMultiple") != null ? request.getParameter("isMultiple").equalsIgnoreCase("true") : false ;
%>
<lov:lov  lovObj="<%=lov%>" reqObj="<%=request%>" isMultiple="<%=isMultiple%>"></lov:lov>
<%System.out.println("send lov tag and end server page : " + (new java.util.Date().getTime() - startDate.getTime())/1000) ;%>